﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;

namespace ElectricDim
{
	internal class SelectionFilter : ISelectionFilter
	{
		public bool AllowElement(Element element)
		{
			if (element is FamilyInstance)
			{
				ConnectorSetIterator connectorSetIterator = (element as FamilyInstance).MEPModel.ConnectorManager.Connectors.ForwardIterator();
				while (connectorSetIterator.MoveNext())
				{
					if ((connectorSetIterator.Current as Connector).Domain == (Autodesk.Revit.DB.Domain)2)
					{
						return true;
					}
				}
			}
			return false;
		}

		public bool AllowReference(Reference refer, XYZ point)
		{
			return false;
		}
	}
}
